package com.yoomiito.app.net;

import android.util.Log;

import com.yoomiito.app.model.LiveRecord;

import cn.droidlover.xdroidmvp.net.ApiException;
import cn.droidlover.xdroidmvp.net.ApiSubscriber;
import cn.droidlover.xdroidmvp.net.XApi;

public class LiveRecordUtils {
    private String cid;
    private String open;

    // 直播-开启录制视频
    public void liveRecord(String cid, String open) {
        this.cid = cid;
        this.open = open;
//        Log.i("YOM","CID:"+cid+"   open:"+open);
        YmApi.getYmService()
                .liveRecord(cid, open)
                .compose(XApi.getApiTransformerData())
                .compose(XApi.getScheduler())
                .subscribe(new ApiSubscriber<LiveRecord>() {
                    @Override
                    public void onSuccess(LiveRecord liveRecord) {

                    }

                    @Override
                    public void onFail(ApiException error) {
                        //
                        liveRecord(cid,open);
                    }
                });
    }
}
